// Created by Joe on 2017/7/21.

app.service(
    'SocialSecurityService',
    [
        'RequestProxyService',
        function (RequestProxyService) {
            return {
                getTotalInfo: RequestProxyService.requestProxy('/social/homePage', {}, {},
                    function (resolve, info) {
                        resolve({total: info.result});
                    }),
                getPensionInfo: RequestProxyService.requestProxy('/social/socialPension', {}, {},
                    function (resolve, info) {
                        resolve({pension: info.result});
                    }),
                getMedicalInfo: function (startDate, endDate) {
                    return RequestProxyService.requestProxy('/social/socialMedical', {},
                        {startDate: startDate, endDate: endDate},
                        function (resolve, info) {
                            resolve({medical: info.result[0] ? info.result[0].medicalDetail : []})
                        })();
                },
                getRetirementInfo: RequestProxyService.requestProxy('', {}, {}, function (resolve, info) {

                }),
                getUnemploymentInfo: RequestProxyService.requestProxy('', {}, {}, function (resolve, info) {

                })
            };
        }
    ]
);